﻿using System.ComponentModel;
using System.Windows.Input;

namespace BreathingEffectDemo
{
    public class MainViewModel : INotifyPropertyChanged
    {
        private bool _isBreathing;

        public bool IsBreathing
        {
            get => _isBreathing;
            set
            {
                _isBreathing = value;
                OnPropertyChanged(nameof(IsBreathing));
            }
        }

        public ICommand ToggleBreathingCommand { get; }

        public MainViewModel()
        {
            ToggleBreathingCommand = new RelayCommand(() =>
            {
                IsBreathing = !IsBreathing;
            });
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

